import {req_delete, req_get, req_post, req_put} from "@/request/cssdrequest";
import {R} from "@/type/dto/R";
import {ScheduleTypeVO} from "@/type/vo/ScheduleTypeVO";

export async function api_listScheduleType(id: string, officeCode: string) {
    const data = await req_get('/schedule/type', {
        id,
        officeCode
    });
    //转成我要的json
    console.log('data:', data);
    return JSON.parse(data) as R<Array<ScheduleTypeVO>>;
}

export async function api_addScheduleType(scheduleType: ScheduleTypeVO
) {

    const data = await req_post('/schedule/type', scheduleType);
    //转成我要的json
    console.log('data:', data);
    return JSON.parse(data) as R<string>;
}

export async function api_updateScheduleType(scheduleType: ScheduleTypeVO
) {

    const data = await req_put('/schedule/type', scheduleType);
    //转成我要的json
    console.log('data:', data);
    return JSON.parse(data) as R<string>;
}


export async function api_deleteScheduleType(deleteId: string) {

    const data = await req_delete('/schedule/type', {
        id: deleteId
    });
    //转成我要的json
    console.log('data:', data);
    return JSON.parse(data) as R<object>;
}

//
//
// export async function api_getExamInfo(examId: string) {
//     const data = await req_get('/exam/all', {
//         id: examId
//     });
//     //转成我要的json
//     console.log('data:', data);
//     return JSON.parse(data) as R<ExamVO>;
// }
//
// export async function api_createExam(examType: number,
//                                      creatorCode: string,
//                                      title: string) {
//
//     const data = await req_post('/exam', {
//         examType,
//         creatorCode,
//         title,
//         status: 0,
//         totalScore: 0
//     });
//     //转成我要的json
//     console.log('data:', data);
//     return JSON.parse(data) as R<string>;
// }
//
// export async function api_updateExam(exam:ExamVO) {
//
//     const data = await req_put('/exam', exam);
//     //转成我要的json
//     console.log('data:', data);
//     return JSON.parse(data) as R<string>;
// }
// export async function api_publicExam(officeExam:PublishExamInfo) {
//
//     const data = await req_put('/exam/publish', officeExam);
//     //转成我要的json
//     console.log('data:', data);
//     return JSON.parse(data) as R<string>;
// }
